package com.xukai.springboot.controller.question;

import com.xukai.springboot.controller.patient.PatientController;
import com.xukai.springboot.entity.question.t_q_item;
import com.xukai.springboot.entity.question.t_q_main;
import com.xukai.springboot.entity.request.question.DelQuestionRequest;
import com.xukai.springboot.entity.request.question.QuestionRequest;
import com.xukai.springboot.entity.response.PageResult;
import com.xukai.springboot.entity.response.ResponseBase;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(basePath = "api/question", description = "问题管理")
@RestController
@RequestMapping("api/question/*")
public class QuestionController {

    /**
     * 日志
     */
    private final Logger logger = LoggerFactory.getLogger(QuestionController.class);


    /**
     * 获取问题列表
     */
    @ApiOperation(value = "获取问题列表", notes = "获取问题列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "StartIndex", value = "数据检索起始行", required = true, dataType = "int", example = "0",defaultValue ="0" , paramType = "query"),
            @ApiImplicitParam(name = "PageSize", value = "检索数据总是", required = true, dataType = "int", example = "0",defaultValue ="0" , paramType = "query"),
            @ApiImplicitParam(name = "TypeID", value = "问题类型ID", required = true, dataType = "int", example = "0",defaultValue ="0" , paramType = "query"),
            @ApiImplicitParam(name = "Title", value = "问题标题", required = false, dataType = "string", paramType = "query")
    })
    @GetMapping("GetQuestionList")
    public ResponseBase<PageResult<t_q_main>> GetQuestionList(@RequestParam int StartIndex, @RequestParam int PageSize, @RequestParam int TypeID,
                                                              @RequestParam String Title) {
        ResponseBase<PageResult<t_q_main>> result = new ResponseBase<>();
        try {
        } catch (Exception e) {
            logger.error("获取问题列表", e);
            result.setStatue(0);
        }
        return result;
    }

    /**
     * 新建问题
     */
    @ApiOperation(value = "新建问题", notes = "新建问题")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Param", value = "问题信息", required = true, dataType = "QuestionRequest", paramType = "body")
    })
    @PostMapping("CreateQuestion")
    public ResponseBase<QuestionRequest> CreateQuestion(@RequestBody QuestionRequest Param) {
        ResponseBase<QuestionRequest> result = new ResponseBase<>();
        try {
        } catch (Exception e) {
            logger.error("新建问题", e);
            result.setStatue(0);
        }
        return result;
    }

    /**
     * 获取问题详情
     */
    @ApiOperation(value = "获取问题详情", notes = "获取问题详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "QuestionID", value = "问题ID", required = true, dataType = "int", example = "0",defaultValue ="0" , paramType = "query")
    })
    @PostMapping("GetQuestion")
    public ResponseBase<QuestionRequest> GetQuestion(@RequestBody int QuestionID) {
        ResponseBase<QuestionRequest> result = new ResponseBase<>();
        try {
        } catch (Exception e) {
            logger.error("新建问题", e);
            result.setStatue(0);
        }
        return result;
    }

    /**
     * 编辑问题
     */
    @ApiOperation(value = "编辑问题", notes = "编辑问题")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Param", value = "问题信息", required = true, dataType = "QuestionRequest", paramType = "body")
    })
    @PostMapping("EditQuestion")
    public ResponseBase EditQuestion(@RequestBody QuestionRequest Param) {
        ResponseBase result = new ResponseBase();
        try {
        } catch (Exception e) {
            logger.error("新建问题", e);
            result.setStatue(0);
        }
        return result;
    }

    /**
     * 删除问题
     */
    @ApiOperation(value = "编辑问题", notes = "编辑问题")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Param", value = "问题信息", required = true, dataType = "DelQuestionRequest", paramType = "body")
    })
    @PostMapping("DelQuestion")
    public ResponseBase DelQuestion(@RequestBody DelQuestionRequest Param) {
        ResponseBase result = new ResponseBase();
        try {
        } catch (Exception e) {
            logger.error("删除问题", e);
            result.setStatue(0);
        }
        return result;
    }

    /**
     * 获取问题选项列表
     */
    @ApiOperation(value = "获取问题选项列表", notes = "获取问题选项列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "QuestionID", value = "问题ID", required = true, dataType = "int", example = "0",defaultValue ="0" , paramType = "query")
    })
    @GetMapping("GetItems")
    public ResponseBase<List<t_q_item>> GetItems(@RequestParam int QuestionID) {
        ResponseBase result = new ResponseBase();
        try {
        } catch (Exception e) {
            logger.error("获取问题选项列表", e);
            result.setStatue(0);
        }
        return result;
    }
}
